package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.AreaBean;
import com.project.service.IAreaService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author RJ
 * @date 2022/9/16 9:40
 */
@RestController
@RequestMapping("area")
public class AreaController {
    @Resource
    private IAreaService areaService;

    @RequestMapping("add")
    public String addArea(AreaBean areaBean) {
        areaService.addArea(areaBean);
        return "ok";
    }

    @RequestMapping("info")
    public IPage<AreaBean> cutAreaByItem(Integer pageNo, Integer pageSize, String areaName, String areaForestType, String className) {
        IPage<AreaBean> page = areaService.cutAreaByItem(pageNo, pageSize, areaName, areaForestType, className);
        return page;
    }

    @RequestMapping("result")
    public List<AreaBean> findArea() {
        List<AreaBean> list = areaService.findArea();
        return list;
    }
}
